<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>编辑部门</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" type="text/css" href="assets/layui/css/layui.css" />
		<link rel="stylesheet" type="text/css" href="assets/css/all.css"  />
		<style>
			.layui-input-4 {
			    width: 600px;
			    float: left;
			}
		</style>
	</head>
<body style="background-color:#fff;padding:20px;">
	<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
	<!--[if lt IE 9]>
		  <script src="assets/js/html5.min.js"></script>
		  <script src="assets/js/respond.min.js"></script>
		<![endif]-->
    <form class="layui-form" action="" onsubmit="return false;">
   		 <div class="layui-form-item">
            <label class="layui-form-label">部门名称</label>
            <div class="layui-input-4">
                <input type="text" name="name" lay-verify="required" value="技术部" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">上级部门</label>
            <div class="layui-input-4">
                <input id="department" type="text" name="company" class="layui-input" value="河北分公司" lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">排序号</label>
            <div class="layui-input-4">
                <input type="text" name="listnum"  value="0" class="layui-input" >
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" class="layui-btn" lay-submit="" lay-filter="submit-btn">确定</button>
                <button class="layui-btn cancelBtn layui-btn-danger">取消</button>
            </div>
        </div>
    </form>
	<script src="assets/layui/layui.js" type="text/javascript"></script>
	<script src="assets/js/all.js" type="text/javascript"></script>
	<script type="text/javascript">
		layui.use(['layer','form'],function(){
			var layer = layui.layer,
				form = layui.form,
				$ = layui.$
			
			//监听提交
			form.on('submit(submit-btn)', function(data) {
//				$.ajax({
//					type:"post",
//					url:"{:U('manager/System/site')}",
//					data:data.field,
//					dataType:"json",
//					success:function(data){
//						if (data.code == 1) {
//							layer.msg(data.msg,{icon:6,time:1000}, function(){
//								top.location.reload();
//							});
//						} else {
//							layer.msg(data.msg, {icon:5,time:1000});
//						}
//					},
//					error: function(jqXHP,textStatus,errorThrown){
//	                    layer.alert(jqXHP.responseText);
//	                }
//				});
				return false;
				window.location.href="department.html"
			});
			
			$("#department").click(function(){
				var index = layer.open({
					type:2,
					area:['500px','400px'],
					content:'chooseDepart.html',
					btn:["确认"],
					yes:function(idnex,layero){
						var body = layer.getChildFrame('body', index);
		                var iframeWin = window[layero.find('iframe')[0]['name']];//得到iframe页的窗口对象，执行iframe页的方法：
		                var ids = iframeWin.getVal();//调用子页面的方法，得到子页面返回的ids
		                $("#department").val(ids);
		                layer.close(index);//需要手动关闭窗口
					}
				})
			})
		})
	</script>
</body>
</html>
